#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e4 + 5;

int n, m;
int vis[N], primes[N], tot;
void init(int n) {
  vis[1] = 1;
  rep(i, 2, n) {
    if (!vis[i]) primes[++tot] = i;
    rep(j, 1, tot) {
      ll k = 1ll * primes[j] * i;
      if (k > n) break;
      vis[k] = 1;
      if (i % primes[j] == 0) break;
    }
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  init(n);
  rep(i, 1, tot) {
    int x = 1, y = 0;
    while (x * primes[i] <= n) {
      x *= primes[i];
      y += n / x;
    }
    cout << primes[i] << ' ' << y << endl;
  }
  return 0;
}
